<template>
  <div>
    <h3 style="margin:20px 0;">添加角色</h3>
    <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="角色名称" id="boxEl">
          <el-input
            v-model="form.roleName"
            placeholder="填写名称"
          ></el-input>
        </el-form-item>
        
      <el-form-item label="描述信息">
        <el-input
          type="textarea"
          v-model="form.desc"
          id="elWen"
          placeholder="请输入描述信息"
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button>取消</el-button>
        <el-button type="primary" @click="postData">保存</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<style scoped>

</style>
<style >
#elWen {
  width: 900px;
  height: 100px;
}
#boxEl{
  width:400px;
}
</style>
<script>
export default {
  data() {
    return {
      form: {
        roleName: "",
        personnelNumber: "",
        desc:""

      },
      
        defaultProps: {
          children: 'children',
          label: 'label'
        }
    };
  },
  methods: {
    postData:function(){
      this.$axios({
        url:'/role/add',
        method:'post',
        data:{
         desc:this.form.desc,
         roleName: this.form.roleName
         
        }
      }).then((res)=>{
        if(res.data.code==0){
           this.$router.push("/home/Jsgl");
        }else{
          console.log('sb')
         
        }
      })
    }
  },
  mounted:function(){
    
  }
};
</script>